package com.nb.hdj.util;

import com.nb.hdj.baseClass.CreateDriverBase;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Listeners;

import java.net.MalformedURLException;

/**
 * @Description: 基础测试类 用于其他类继承
 * @Author: hedongjia
 * @Date: 2021/11/03 下午12:22
 * @Version: v1.0
 */

/**
 * 监听注解
 */
@Listeners({TestngListener.class})
public class BaseTest {
    public CreateDriverBase base;
    public WebDriver driver;
    public WebDriver getDriver(){
        return driver;
    }
    @BeforeClass
    public void setUp() {
        //System.setProperty("webdriver.chrome.driver", "resource/chromedriver.exe");
        try {
            base=new CreateDriverBase();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        driver = base.getDriver();
    }


    @AfterClass
    public void tearDown() {
        driver.quit();
    }

}